#include "camera.h"


Camera::Camera() : base(), position(0.0,0.0,0.0), sceneCenter(0.0,0.0,1.0), angleX(80), angleY(60) {}
Camera::~Camera()
{
    //std::cout<<"~Camera()"<<std::endl;
}

Camera::Camera(const Camera &camera) : base(), position(camera.position), sceneCenter(camera.sceneCenter), angleX(camera.angleX), angleY(camera.angleY)
{
    base[0] = camera.base[0];
    base[1] = camera.base[1];
    base[2] = camera.base[2];
}

Camera& Camera::operator=(const Camera &camera)
{
    position    = camera.position;
    sceneCenter = camera.sceneCenter;
    angleX      = camera.angleX;
    angleY      = camera.angleY;
    base[0] = camera.base[0];
    base[1] = camera.base[1];
    base[2] = camera.base[2];
    return (*this);
}

Camera::Camera(const Point3D &origin, const Point3D &center,const double &angleWidth, const double &angleHeight)
    : base(), position(origin), sceneCenter(center), angleX(angleWidth), angleY(angleHeight)
{
    precomputeBase();
}


inline void Camera::precomputeBase()
{

}

inline void Camera::setPosition(const Point3D &cameraPosition)
{
    position = cameraPosition;
    precomputeBase();
}

inline void Camera::setSceneCenter(const Point3D &_sceneCenter)
{
    sceneCenter = _sceneCenter;
    precomputeBase();
}

inline void Camera::setViewAngles(const double &angleWidth, const double &angleHeight)
{
    angleX = angleWidth;
    angleY = angleHeight;
}


inline Point3D Camera::getPosition() const
{
    return position;
}

inline Point3D Camera::getSceneCenter() const
{
    return sceneCenter;
}

inline double  Camera::getWidthAngle() const
{
    return angleX;
}

inline double  Camera::getHeightAngle() const
{
    return angleY;
}


inline Vector3D Camera::getViewVector() const
{
    return (sceneCenter-position);
}

